<template>
  <div>
    <a-table
      rowKey="id"
      class="wearing-table"
      :columns="callLogColumns"
      :dataSource="dataSource"
      @change="handleTableChange"
      :pagination="ipagination"
    >
    </a-table>
  </div>
</template>

<script>
import { JeecgListMixinNew } from '@/mixins/JeecgListMixinNew'

export default {
  mixins: [JeecgListMixinNew],
  props: {
    imei: {
      type: String,
      default: '',
    },
  },
  data() {
    return {
      url: {
        list: '/wb/device/deviceEventPage',
      },
      callLogColumns: [
        {
          title: '序号',
          align: 'center',
          width: 100,
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          },
        },
        {
          title: '类型',
          align: 'center',
          dataIndex: 'type',
          customRender: function (t, r, index) {
            const typeMap = {
              1: 'SOS',
              4: '电子围栏触发',
              8: '运动心率异常',
            }
            return typeMap[t] ? typeMap[t] : ''
          },
        },
        {
          title: '发生时间',
          align: 'center',
          dataIndex: 'eventTime',
          ellipsis: true,
        },
        {
          title: '发生地点',
          align: 'center',
          dataIndex: 'address',
          ellipsis: true,
        },
      ],
      times: {},
      extendParams: {},
      disableMixinCreated: true,
    }
  },
  watch: {
    imei(newVal) {
      if (newVal) {
        this.extendParams.imei = newVal
        this.loadData(1)
      }
    },
  },
  method: {
    handleChange() {},
  },
}
</script>
